Repository navigation
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 49 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2b04fc9f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const restoreFnCallNames = (container) => { | ||
| if (!container || typeof container !== 'object') return; | ||
| if (container.type === 'function_call' && container.name) { | ||
| container.name = clientToolName(container.name); |
There was a problem hiding this comment.
Restore only aliases applied to the current request
When a client defines a tool named terminal or run_command, the outbound request preserves that name, but this unconditional reverse mapping changes its returned function calls to bash or shell. This also defeats the outbound collision guard when both original and alias names are defined, potentially dispatching the wrong tool. Track the aliases actually applied to each request and use only that request-local mapping when restoring buffered responses and SSE events.
Useful? React with 👍 / 👎.
| while ((idx = buf.indexOf('\n\n')) >= 0) { | ||
| res.write(restoreEventBlock(buf.slice(0, idx)) + '\n\n'); | ||
| buf = buf.slice(idx + 2); |
There was a problem hiding this comment.
Recognize CRLF-delimited SSE events before buffering further
If upstream sends SSE events with CRLF line endings, the event separator is \r\n\r\n, so this search never finds a boundary. Unlike the previous streaming passthrough, the proxy buffers the entire response until upstream closes, withholding all incremental output and potentially triggering client idle timeouts during long generations. Recognize CRLF boundaries as well as LF boundaries, including separators split across reads.
Useful? React with 👍 / 👎.
| const next = directToolAlias(holder.name, taken); | ||
| if (next !== holder.name) { holder.name = next; changed = true; } |
There was a problem hiding this comment.
Exclude inherited properties from outbound alias lookups
On native Responses requests containing a function named constructor, toString, or __proto__, this newly added aliasing step corrupts the tool definition even though none of those names is a configured alias. directToolAlias indexes a normal object without checking ownership, so it returns inherited functions or objects; assigning that result here makes serialization omit the tool name or emit name: {}. These requests previously passed through unchanged and now reach upstream with invalid definitions. Require an own-property match in the alias table before replacing a name.
Useful? React with 👍 / 👎.
|
Superseded by #2766, which landed the same passthrough aliasing in parallel (outbound tool/history/tool_choice rename, inbound restore for JSON + SSE, byte-for-byte otherwise) while this PR sat in GitHub's merge outage. Closing in its favor; the laptop verification of the combined state is being reported on #2753. |
Follow-up to #2764, completing the #2753 Phase-2 wiring (contributor PR #2762, config PRs #2761/#2763).
#2764 aliased the shell tools on the chat-translation path and deferred the passthrough: "aliasing there is a follow-up if that route gains a client." The route has a client now —
muse-direct(@ai-sdk/openai, Responses-native) — and the deferral bites: verified live on the laptop, a throwaway-serve session onmuse-direct/muse-spark-1.3-contributorfailed with 403client_attestation_denied, because the passthrough forwarded OpenCode's tool definitions verbatim. Bisecting the gate showed it is the tool NAME:bash/shell(alsoapply_patch,search,read_file,write_file,edit_file) trip it; instructions, headers, tool_choice, parallel_tool_calls, and every other tool name pass; aliasing to a non-blocked name passes and the model calls the alias normally.What
function_callinput items, and a functiontool_choiceare aliased with the same map as the chat path (shell→run_command,bash→terminal, same collision guard).function_callnames are restored to the client's names in buffered JSON responses and per-event in SSE streams (non-JSON event payloads pass untouched).Test
New test: client sends
bashtool + history call + tool_choice → upstream seesterminaleverywhere; upstream'sterminalcall comes back asbashin both the buffered response and the SSE stream. Full suite on the laptop: 23/23 pass.Need help on this PR? Tag
@codesmith-botwith what you need.